/*
 * fish.h
 *
 *  Created on: Mar 13, 2011
 *      Author: Sharks group.
 */

#define FISH_RANDOM_MODE 1
#define FISH_LIMIT_SPEECH 10

typedef struct tagFish
{
	unsigned short x;
	unsigned short y;
	unsigned short initx;
	unsigned short inity;
	unsigned short speech;
	unsigned short size;
	unsigned short danger;
}Fish;

//new a Fish
Fish fish_new(unsigned short x, unsigned short y, unsigned short speech, unsigned short danger)
{
  Fish fish;
  fish.x = x;
  fish.y = y;
  fish.initx = x;
  fish.inity = y;
  fish.speech = speech;
  fish.danger = danger;
  return fish;
}

//reset the fish position reaching left border in order to avoid image broken
void recheckFishPosition(Fish * fish){
	if (fish->x < fish->speech) {
		changePositionRandomMode(fish);
	}
}

//change the fish speech
void changeFishSpeech(Fish * fish, int speech){
	if(fish->speech < FISH_LIMIT_SPEECH){
		fish->speech += speech;
	}
}
//reset the fish initial position randomly
void resetFishPosition(Fish * fish){
	changePositionRandomMode(fish);
}

//initial a random position for the fish
void changePositionRandomMode(Fish * fish){
	if(FISH_RANDOM_MODE){
		fish->y = random(145);
		fish->x = random_range(220, 240);
	}
}



